package com.example.demo.controller;

import com.example.demo.utils.IpUtil;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.List;

/**
 * @author crazyZcy
 */
@RestController
public class BookController {

    @GetMapping(value = "/name/obtain/book")
    public List<String> nameObtainBook(HttpServletRequest request){
        ArrayList<String> strings = new ArrayList<>();
        strings.add("123");
        strings.add("456");
        //获取IP地址
        String ipAddress = IpUtil.getIpAddr(request);
        strings.add(ipAddress);
        return strings;
    }
}
